<template>
	<view class="">



		<view v-if="list.length==0" class="margin-top-sm">
			<blues-empty img="msg" text="暂无数据">

			</blues-empty>
		</view>
		<view :class="{'bg-white  padding-sm list-item  margin-top-sm':true}" v-for="(item,index) in list"
			@click="onClick(item)" :style="{animationDelay:gets(index)}">
			<view style="z-index:3;position: relative;">
				<view style="display: flex;justify-content: space-between;">
					<view>
						<view style="font-weight: bold;">{{item.title}}</view>
						<view class="font-12 margin-top-xs ">{{item.content}}</view>

					</view>

					<view style="text-align: right;">
						<view class="margin-right-xs font-12" style="z-index: 3;">
							操作
						</view>
						<view class="font-12 margin-top-xs" style="">
							{{item.createTime}}
						</view>

					</view>


				</view>



			</view>
		</view>


	</view>

</template>

<script>
	import {
		doUpdate,
		getMyList,
		getMyListCount,
		doInsert
	} from "@/api/system/todolist/SysToDoListManagementApi";
	import {
		isNull
	} from '@/utils/validate'

	export default {

		data() {
			return {
				queryFrom: {
					isOk_EQ: 0,
					isIgnore_EQ: "",
				},
				total: 0,
				list: []
			}
		},
		mounted() {

		},
		onLoad(op) {
			if (op.customerId != null) {
				this.queryFrom.customerId_EQ = op.customerId
			}
			this.init()
		},
		// 触底事件 - 上拉加载
		onReachBottom() {
			// 加判断： 页码数 * 每一页获取数据的条数 >= 总条数，如果符合条件说明数据已经全部加载完毕
			if (this.queryFrom.pageNo * this.queryFrom.pageSize >= this.total) {

				return
			} else {

				this.queryFrom.pageNo++ // 每触发一次触底事件，页码加1
				this.listAdd() // 请求接口，获取数据  
			}
		},
		methods: {
			gets(index) {
				if (index < 10) {
					return index * 0.2 + 's'
				} else {
					return (index % 10 + 1) * 0.2 + 's'
				}

			},


			init() {
				this.list = []
				this.total = 0
				this.queryFrom.pageNo = 1
				//查询合同信息
				this.fetchData()
			},
			listAdd() {
				//查询合同信息
				this.fetchData()
			},
			async fetchData() {
				const {
					data
				} = await getMyList(this.queryFrom);
				if (!isNull(data)) {
					for (let s of data) {
						this.list.push(s)
					}
					this.total = data.total;
				}

			},

		}
	}
</script>

<style>
	.navbar {

		width: 100%;


		background-color: #f1f1f1;
		z-index: 4;
		text-align: center;

		/* 兼容 */

		position: -webkit-sticky;

		position: -ms-sticky;

		position: -o-sticky;

		/* 粘性定位*/

		position: sticky;

		left: 0;

		top: 0
	}
</style>